package com.fit2cloud.common.provider.impl.proxmox;

import com.fit2cloud.common.platform.credential.impl.ProxmoxCredential;
import com.fit2cloud.common.provider.IBaseCloudProvider;
import com.fit2cloud.common.provider.entity.F2CBalance;
import org.apache.commons.collections4.keyvalue.DefaultKeyValue;
import org.pf4j.Extension;

import java.util.List;
import java.util.Map;

@Extension
public class ProxmoxBaseCloudProvider implements IBaseCloudProvider {

    public static final String logoSvg = "<svg t=\"1689604058712\" class=\"icon\" viewBox=\"0 0 6144 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"13983\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"100%\" height=\"100%\"><path d=\"M271.36 84.736l-14.378667 7.978667c-26.026667 15.274667-24.874667 23.338667 2.176 55.722666l224.682667 260.48c51.413333 58.965333 68.394667 77.354667 70.613333 77.354667 5.632 0.725333 320.682667-358.656 324.181334-369.493333 1.365333-2.986667-8.362667-13.141333-20.906667-22.528-15.146667-11.946667-31.445333-17.194667-59.946667-19.114667l-8.917333-0.512c-61.653333-4.181333-84.565333 9.173333-157.226667 93.44l-75.093333 86.613333-2.645333-2.730666a1601.621333 1601.621333 0 0 1-21.461334-24.277334L490.496 179.2c-35.456-41.386667-76.501333-82.858667-90.453333-90.837333-32-18.901333-97.365333-20.309333-128.682667-3.626667z m222.293333 520.362667L332.16 791.466667c-56.405333 65.792-96.597333 113.834667-97.664 116.522666-1.194667 2.645333 6.357333 10.965333 16.853333 19.413334l4.053334 3.157333c15.146667 11.861333 31.488 17.152 59.946666 19.114667l8.917334 0.469333c58.922667 4.053333 83.456-8.874667 151.168-86.869333l61.226666-71.04c11.946667-13.568 19.584-22.101333 19.925334-22.101334l2.645333 2.730667c4.906667 5.290667 16.085333 18.005333 30.677333 34.773333l48.768 56.362667c68.522667 77.824 91.306667 89.514667 150.186667 86.186667 34.133333-1.493333 52.181333-6.570667 68.906667-19.626667 12.501333-9.472 22.229333-19.626667 20.864-22.528l-1.749334-2.730667c-25.514667-35.285333-317.056-367.488-322.432-366.762666l-1.28 0.938666c-5.632 4.992-27.776 29.525333-59.52 65.578667z\" fill=\"#000000\" p-id=\"13984\"></path><path d=\"M125.312 191.530667c-34.048 13.781333-52.181333 26.88-52.181333 36.992 0 4.693333 45.909333 61.098667 104.106666 128.768l110.378667 128.085333c13.866667 16.469333 22.016 26.453333 22.016 27.008l-3.157333 4.224c-6.186667 7.68-21.077333 25.258667-41.386667 48.938667l-94.976 110.250666c-55.04 64.682667-96.213333 117.461333-95.573333 122.624 3.456 19.626667 60.501333 44.288 102.229333 44.288l8.917333-0.170666c58.794667-1.962667 79.36-19.456 206.933334-165.333334l71.082666-82.090666c40.746667-47.616 68.522667-81.237333 68.522667-82.773334 0-2.858667-57.728-71.082667-128.682667-152.362666L359.765333 310.570667C296.149333 239.488 262.101333 205.738667 244.224 197.333333c-32.64-16.725333-85.504-19.626667-118.912-5.802666z m742.912 5.034666c-19.456 10.496-67.242667 59.392-149.034667 152.448l-82.176 94.976c-33.834667 39.637333-56.106667 66.56-56.106666 68.394667 0 1.834667 22.528 29.056 56.746666 69.12l92.032 106.154667c125.397333 143.061333 142.293333 154.325333 206.677334 155.050666 41.770667 0 98.773333-24.661333 102.272-44.288 0.512-5.12-30.933333-45.738667-75.690667-98.730666l-147.328-172.117334a196.693333 196.693333 0 0 1-12.117333-15.189333l3.157333-4.266667c12.373333-15.445333 59.648-71.04 115.114667-135.125333l28.032-32.426667c51.626667-60.330667 89.386667-108.544 88.832-113.493333-3.498667-18.858667-54.954667-40.618667-99.498667-43.562667-28.8-1.28-45.184 0.938667-64.426667 9.856l-6.485333 3.2z\" fill=\"#F66700\" p-id=\"13985\"></path><path d=\"M1217.92 256.213333c0-24.917333 20.224-45.141333 45.141333-45.141333h391.253334a150.485333 150.485333 0 0 1 150.442666 150.442667v135.424a150.485333 150.485333 0 0 1-150.485333 150.485333h-285.866667a150.485333 150.485333 0 0 1-150.485333 150.442667V256.213333z m406.272 90.282667h-255.786667v163.584h255.786667c24.917333 0 45.141333-20.224 45.141333-45.141333V391.637333c0-24.96-20.224-45.141333-45.141333-45.141333z m692.138667-135.424a150.485333 150.485333 0 0 1 150.485333 150.442667v135.424a150.528 150.528 0 0 1-100.565333 141.994666l98.218666 135.04a15.061333 15.061333 0 0 1-12.16 23.893334h-76.672A135.424 135.424 0 0 1 2261.333333 735.146667l-55.850666-87.722667h-175.061334a150.485333 150.485333 0 0 1-150.485333 150.442667V256.213333c0-24.917333 20.224-45.141333 45.141333-45.141333h391.210667z m-30.08 135.424h-255.786667v163.584h255.786667c24.917333 0 45.141333-20.224 45.141333-45.141333V391.637333c0-24.96-20.224-45.141333-45.141333-45.141333z m692.138666-135.424a150.485333 150.485333 0 0 1 150.442667 150.442667v285.866666a150.485333 150.485333 0 0 1-150.442667 150.485334h-285.866666a150.485333 150.485333 0 0 1-150.485334-150.442667v-285.866667a150.485333 150.485333 0 0 1 150.442667-150.485333h285.866667z m-45.141333 150.442667h-195.626667c-24.917333 0-45.141333 20.224-45.141333 45.141333v195.626667c0 24.917333 20.224 45.141333 45.141333 45.141333h195.626667c24.917333 0 45.141333-20.224 45.141333-45.141333V406.613333c0-24.917333-20.224-45.141333-45.141333-45.141333z m2241.92-150.442667a150.485333 150.485333 0 0 1 150.485333 150.442667v285.866666a150.485333 150.485333 0 0 1-150.485333 150.485334h-285.866667a150.485333 150.485333 0 0 1-150.485333-150.442667v-285.866667a150.485333 150.485333 0 0 1 150.485333-150.485333h285.866667z m-45.141333 150.442667h-195.584c-24.96 0-45.141333 20.224-45.141334 45.141333v195.626667c0 24.917333 20.181333 45.141333 45.141334 45.141333h195.584c24.917333 0 45.141333-20.224 45.141333-45.141333V406.613333c0-24.917333-20.224-45.141333-45.141333-45.141333zM3986.474667 211.072h90.282666c0.938667 0 1.834667 0 2.688 0.128a136.96 136.96 0 0 1 129.408 79.786667l87.210667 190.208 87.253333-190.208a136.96 136.96 0 0 1 125.013334-79.872l4.394666 0.085333 1.322667-0.085333 91.648-0.042667c33.237333 0 60.16 26.922667 60.16 60.16v534.613333l-4.352-0.085333a165.546667 165.546667 0 0 1-161.152-165.461333V407.082667l-0.128-1.365334a7.509333 7.509333 0 0 0-7.381333-6.144 11.946667 11.946667 0 0 0-10.794667 6.784l-24.064 52.352-22.912 49.237334c-45.312 96.725333-79.786667 165.717333-103.381333 206.933333-8.192 14.421333-17.664 23.296-28.288 26.666667-0.256 1.621333-0.597333 2.048-0.938667 1.322666-16.170667 6.144-30.037333-0.938667-41.642667-21.205333l-5.717333-10.154667-6.229333-11.434666c-31.402667-58.624-77.653333-156.544-138.752-293.717334a11.946667 11.946667 0 0 0-10.794667-6.826666 7.509333 7.509333 0 0 0-7.381333 6.186666l-0.128 1.365334v233.216a165.546667 165.546667 0 0 1-161.152 165.461333l-4.352 0.042667V271.274667c0-33.28 26.922667-60.202667 60.16-60.202667z\" fill=\"#000000\" p-id=\"13986\"></path><path d=\"M3189.034667 751.872l230.442666-247.125333-226.133333-251.178667a165.546667 165.546667 0 0 1 233.813333 12.245333L3532.8 383.232l107.733333-115.541333a165.546667 165.546667 0 0 1 230.741334-11.093334l3.2 2.944-230.485334 247.168 226.133334 251.136a165.546667 165.546667 0 0 1-233.728-12.245333l-105.728-117.376-107.690667 115.498667a165.546667 165.546667 0 0 1-230.741333 11.093333l-3.2-2.944zM5385.813333 751.872l230.485334-247.125333-226.133334-251.178667a165.546667 165.546667 0 0 1 233.770667 12.245333l105.685333 117.418667 107.733334-115.541333a165.546667 165.546667 0 0 1 230.698666-11.093334l3.2 2.944-230.485333 247.168 226.133333 251.136a165.546667 165.546667 0 0 1-233.728-12.245333l-105.685333-117.376-107.733333 115.498667a165.546667 165.546667 0 0 1-230.741334 11.093333l-3.2-2.944z\" fill=\"#F66700\" p-id=\"13987\"></path></svg>";

    public static final String iconSvg = "<svg t=\"1689603953875\" class=\"icon\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"13681\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"100%\" height=\"100%\"><path d=\"M235.349333 96.64l-13.952 7.68c-25.344 14.933333-24.192 22.698667 2.133334 54.229333l218.453333 253.226667c49.92 57.344 66.474667 75.221333 68.650667 75.221333 5.418667 0.682667 311.765333-348.714667 315.136-359.253333 1.322667-2.858667-8.106667-12.757333-20.266667-21.888-14.762667-11.605333-30.634667-16.725333-58.325333-18.602667l-8.661334-0.426666c-59.946667-4.138667-82.261333 8.832-152.874666 90.794666l-72.96 84.181334-2.602667-2.645334c-3.712-4.010667-11.093333-12.373333-20.906667-23.594666l-40.746666-47.146667c-34.474667-40.192-74.368-80.512-87.893334-88.32-31.146667-18.346667-94.72-19.712-125.184-3.456z m216.149334 505.856l-157.013334 181.248c-54.869333 64-93.909333 110.677333-94.933333 113.322667-1.194667 2.56 6.144 10.624 16.384 18.816l3.925333 3.072c14.72 11.52 30.634667 16.682667 58.282667 18.602666l8.661333 0.469334c57.301333 3.925333 81.152-8.661333 146.944-84.48l59.562667-69.034667a460.8 460.8 0 0 1 19.370667-21.504l2.56 2.645333c4.778667 5.12 15.658667 17.493333 29.866666 33.834667l47.36 54.784c66.645333 75.648 88.746667 87.04 146.048 83.754667 33.194667-1.408 50.773333-6.4 66.986667-19.072 12.16-9.173333 21.589333-19.029333 20.266667-21.845334l-1.706667-2.688c-24.789333-34.304-308.266667-357.290667-313.429333-356.565333l-1.28 0.896c-5.461333 4.864-27.008 28.714667-57.856 63.744z\" fill=\"#000000\" p-id=\"13682\"></path><path d=\"M93.397333 200.448C60.245333 213.76 42.666667 226.56 42.666667 236.373333c0 4.608 44.629333 59.434667 101.205333 125.226667l107.306667 124.544c13.482667 15.957333 21.418667 25.685333 21.418666 26.24l-3.072 4.096c-5.973333 7.466667-20.48 24.533333-40.234666 47.573333L136.96 671.232c-53.546667 62.890667-93.568 114.176-92.928 119.253333 3.370667 19.029333 58.837333 43.050667 99.413333 43.050667l8.618667-0.170667c57.173333-1.92 77.226667-18.944 201.216-160.768l69.077333-79.786666c39.594667-46.293333 66.645333-78.976 66.645334-80.426667 0-2.816-56.106667-69.162667-125.098667-148.181333L321.28 316.16C259.456 247.04 226.389333 214.229333 209.066667 206.08c-31.786667-16.256-83.2-19.072-115.626667-5.632z m722.261334 4.864c-18.901333 10.24-65.365333 57.728-144.896 148.224l-79.914667 92.330667c-32.853333 38.528-54.528 64.768-54.528 66.517333 0 1.749333 21.888 28.245333 55.168 67.157333l89.472 103.253334c121.898667 139.093333 138.325333 150.058667 200.96 150.741333 40.576 0 96-24.021333 99.413333-43.093333 0.512-4.906667-30.08-44.458667-73.557333-96l-143.274667-167.253334a191.232 191.232 0 0 1-11.776-14.805333l3.072-4.138667c12.032-15.061333 58.026667-69.12 111.914667-131.413333l27.306667-31.488C945.109333 286.677333 981.845333 239.786667 981.333333 235.008c-3.413333-18.346667-53.418667-39.509333-96.725333-42.368-27.989333-1.28-43.946667 0.896-62.592 9.6l-6.4 3.072z\" fill=\"#F66700\" p-id=\"13683\"></path></svg>";

    public static final CloudAccountMeta meta = new CloudAccountMeta(ProxmoxCredential.class, "fit2cloud_proxmox_platform",
            "Proxmox", false, logoSvg, iconSvg, Map.of());


    public static final Info info = new Info("management-center", List.of(), Map.of());

    @Override
    public F2CBalance getAccountBalance(String getAccountBalanceRequest) {
        return null;
    }

    @Override
    public CloudAccountMeta getCloudAccountMeta() {
        return meta;
    }

    @Override
    public Info getInfo() {
        return info;
    }

    public List<DefaultKeyValue<String, String>> getRealmList(String req) {
        return List.of(new DefaultKeyValue<>("Proxmox VE authentication server", "pve"),
                new DefaultKeyValue<>("Linux PAM standard authentication", "pam"));

    }
}
